package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflectTest {
    public static void main(String[] args) throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException, ClassNotFoundException {

        Class cls = Class.forName("reflect.Student");
        Constructor c = cls.getConstructor();
        Object obj = c.newInstance();
        System.out.println(obj);

        Object obj2 = cls.newInstance();
        System.out.println(obj2);



        Constructor c1 = cls.getConstructor(String.class, int.class, char.class);
        Object obj1 = c1.newInstance("小明", 44, '女');
        System.out.println(obj1);








    }
}
